# coding:utf-8
import os
import shutil
from conftest import BASE_DIR

def test_delect_error():
    save_path = BASE_DIR + r'\error'
    if os.listdir(save_path):
        file_list = os.listdir(save_path)
        for f in file_list:
            file_path = os.path.join(save_path, f)
            if os.path.isfile(file_path):
                os.remove(file_path)
            elif os.path.isdir(file_path):
                shutil.rmtree(file_path, True)
def test_delect_log():
    save_path = BASE_DIR + r'\logger'
    if os.listdir(save_path):
        file_list = os.listdir(save_path)
        for f in file_list:
            file_path = os.path.join(save_path, f)
            if os.path.isfile(file_path):
                os.remove(file_path)
            elif os.path.isdir(file_path):
                shutil.rmtree(file_path, True)

test_delect_error()
test_delect_log()